package com.googlecode.cnasort.cc.rmi.server;

import java.rmi.RemoteException;
import com.googlecode.cnasort.cc.rmi.common.SampleCompute;
import com.googlecode.cnasort.cc.rmi.common.ServerRmiStarter;
import com.googlecode.cnasort.cc.rmi.server.core.SampleComputeEngine;

/**
 * start the server component. this exposes the an implementation of the Compute
 * interface as a service over RMI *
 */
public class ComputeEngineStarter extends ServerRmiStarter<SampleCompute>
{
    public ComputeEngineStarter() 
    {
        super( SampleCompute.class, true );
    }

//    public void doCustomRmiHandling() throws RemoteException 
//    {
//        Compute engine = new ComputeEngine();
//        Compute engineStub = (Compute)UnicastRemoteObject.exportObject(engine, 0);
//
//        Registry registry = LocateRegistry.getRegistry();
//        registry.rebind( Compute.SERVICE_NAME, engineStub );
//    }

    public static void main(String[] args) throws RemoteException 
    {
        //new ComputeEngineStarter().doCustomRmiHandling();
        new ComputeEngineStarter().exportObject( new SampleComputeEngine(), SampleCompute.SERVICE_NAME );
    }
}
